package com.bjsxt.collection;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class TreeMapTest {
    public static void main(String[] args){
        Map<Users,String> map = new TreeMap<>();
        Users u1 =new Users("gf", 21);
        Users u2 =new Users("geef", 11);
        Users u3 =new Users("gewqef", 31);
        map.put(u1,"u1" );
        map.put(u2,"u1" );
        map.put(u3,"u1" );

        Set<Users> keys = map.keySet();
        System.out.println(keys);


        Map<Students1,String> treemap =new TreeMap<>(new StudentComparator());
        Students1 students1 = new Students1("ksdh",13 );
        Students1 students2 = new Students1("ssdh",33 );
        Students1 students3 = new Students1("vdfh",23 );
        treemap.put(students1,"sas" );
        treemap.put(students2,"ss" );
        treemap.put(students3,"s" );

        Set<Students1> keys1 = treemap.keySet();
        System.out.println(keys1);
    }
}


